home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / grafik / bildanzeiger / superview-lib_dev / example_tools / listsvds / listsvds.c < prev    next >
C/C++ Source or Header  |  1995-03-09  |  5KB  |  147 lines

  1. /* ======================================================================== */
  2. /* = Programmname    : ListSVDs V9.1                      = */
  3. /* =                                      = */
  4. /* ======================================================================== */
  5. /* = Autor/Copyright : (c) 1994 by Andreas R. Kleinert.                   = */
  6. /* =               All rights reserved.                  = */
  7. /* ======================================================================== */
  8. /* = Funktion         : Show available svdrivers of superview.library V3+. = */
  9. /* =                                                             = */
  10. /* ======================================================================== */
  11. /* = Letztes Update  : 15.9.1994                          = */
  12. /* =                                      = */
  13. /* ======================================================================== */
  14. /* = Bemerkungen     : "superview.library" V3+ needed.                    = */
  15. /* =                                      = */
  16. /* ======================================================================== */
  17. /* = Compiler         : SAS/C V6.51                        = */
  18. /* =               (smakefile)                                        = */
  19. /* ======================================================================== */
  20.  
  21. #include <superview/superviewbase.h>
  22. #include <svdrivers/svdriverbase.h>
  23.  
  24. #include <proto/exec.h>
  25. #include <proto/dos.h>
  26. #include <proto/superview.h>
  27. #include <proto/svdrivers.h>
  28.  
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31. #include <string.h>
  32.  
  33.  
  34.    /* Help- and Info- Texts */
  35.  
  36. char entry1_text  [] = "\2331;32;40mListSVDs V9.1 \2330;32;40m\2333;32;40m(FREEWARE)\2330;32;40m\n(c) 1993 by Andreas Ralph Kleinert.\nAndreas R. Kleinert, Grube Hohe Grethe 23, D-57074 Siegen, Germany.\n";
  37. char entry2_text  [] = "Lists up available \42svdrivers\42 of \42superview.library\42.\n";
  38. char entry3_text  [] = "USAGE : \2330;33;40mListSVDs\2330;31;40m\n";
  39.  
  40. char ver_text [] = "\0$VER: ListSVDs V9.1 (24.9.94)";
  41.  
  42.  
  43. /* *************************************************** */
  44. /* *                             * */
  45. /* * Error-Messages for Leave() and KF_Message()     * */
  46. /* *                             * */
  47. /* *************************************************** */
  48.  
  49. char svlib_text [] = "You need \42superview.library\42 V3+ !";
  50.  
  51.  
  52. /* *************************************************** */
  53. /* *                             * */
  54. /* * Function Declarations                 * */
  55. /* *                             * */
  56. /* *************************************************** */
  57.  
  58. void __regargs Leave(char *endtext, long code);
  59.  
  60.  
  61.    /* Functions from module "ListSVDs_Subs.o" : */
  62.  
  63. extern void __stdargs K_Printf(char *formatstring, ...);
  64.  
  65.  
  66. /* *************************************************** */
  67. /* *                             * */
  68. /* * Additional Base Declarations             * */
  69. /* *                             * */
  70. /* *************************************************** */
  71.  
  72. extern struct ExecBase *SysBase;
  73.  
  74. struct SuperViewBase *SuperViewBase = N;
  75.  
  76.  
  77. /* *************************************************** */
  78. /* *                             * */
  79. /* * MAIN                         * */
  80. /* *                             * */
  81. /* *************************************************** */
  82.  
  83. void main(long argc, char **argv)
  84. {
  85.  struct List           *drv_list = N;
  86.  struct SVD_DriverNode *svd_node = N;
  87.  
  88.  if(!argc) exit(0); /* started from WB ... */
  89.  
  90.  if( argc > 3 || (argv[1][0] =='?')||(argv[2][0] =='?'))
  91.   {
  92.    K_Printf("%s%s%s", entry1_text, entry2_text, entry3_text);
  93.  
  94.    Leave(N, 0);
  95.   }
  96.  
  97.  SuperViewBase = (struct SuperViewBase *) OpenLibrary("superview.library", 3);
  98.  if(!SuperViewBase) Leave(svlib_text, 100);
  99.  
  100.  K_Printf("\nList of available svdrivers :\n");
  101.  
  102.  drv_list = &SuperViewBase->svb_SVDriverList;
  103.  
  104.  for(svd_node=(APTR) drv_list->lh_Head;(svd_node)&&(svd_node!=(APTR) &(drv_list->lh_Tail));)
  105.   {
  106.    K_Printf("\n  --------------------------------------------------------");
  107.  
  108.    K_Printf("\nSVDriver : \42%s\42", svd_node->svd_FileName);
  109.    K_Printf("\nPriority : %ld",      (long) ((struct Node *)svd_node)->ln_Pri);
  110.    K_Printf("\nDriverID : \42%s\42", svd_node->svd_ID);
  111.    K_Printf("\nFlags    : ");
  112.  
  113.         if(svd_node->svd_Flags & SVDF_INTUITION) K_Printf("Intuition compatible");
  114.    else if(svd_node->svd_Flags & SVDF_FOREIGN)   K_Printf("Foreign display");
  115.    else                                          K_Printf("Unknown display");
  116.  
  117.    svd_node = (APTR) ((struct Node *)svd_node)->ln_Succ;
  118.   }
  119.  
  120.  K_Printf("\n  --------------------------------------------------------");
  121.  
  122.  K_Printf("\n\nCurrently selected Global Driver is : ");
  123.  
  124.  /* retval = */ SVL_GetGlobalDriver(&svd_node, N);
  125.  /* SuperViewBase->svb_GlobalDriver */
  126.  
  127.  if(svd_node) K_Printf("\42%s\42\n\n", svd_node->svd_ID);
  128.   else        K_Printf("- no Driver selected -\n\n");
  129.  
  130.  Leave(N, 0);
  131. }
  132.  
  133. /* *************************************************** */
  134. /* *                             * */
  135. /* * LEAVE : Global Exit Function Replacement         * */
  136. /* *                             * */
  137. /* *************************************************** */
  138.  
  139. void __regargs Leave(char *endtext, long code)
  140. {
  141.  if(SuperViewBase) CloseLibrary((APTR) SuperViewBase);
  142.  
  143.  if(endtext)       K_Printf("%s\n", endtext);
  144.  
  145.  exit(code);
  146. }
  147.